class QuizQuestion {
  QuizQuestion({
    this.qid,
    this.answers,
    this.id,
    this.questionImage,
    this.simpQuestion,
    this.tradQuestion,
    this.questionAudio,
    this.type,
  });

  String? qid;
  List<QuizAnswer>? answers;
  String? id;
  String? questionImage;
  String? simpQuestion;
  String? tradQuestion;
  String? questionAudio;
  String? type;

  factory QuizQuestion.fromJson(Map<String, dynamic> json) => QuizQuestion(
        qid: json["qid"],
        answers: json["answers"] != null
            ? List<QuizAnswer>.from(
                json["answers"].map((x) => QuizAnswer.fromJson(x)))
            : null,
        id: json["id"],
        questionImage: json["question_image"],
        simpQuestion: json["simp_question"],
        tradQuestion: json["trad_question"],
        questionAudio: json["question_audio"],
        type: json["type"],
      );

  Map<String, dynamic> toJson() => {
        "qid": qid,
        "answers": answers != null
            ? List<dynamic>.from(answers!.map((x) => x.toJson()))
            : null,
        "id": id,
        "question_image": questionImage,
        "simp_question": simpQuestion,
        "trad_question": tradQuestion,
        "question_audio": questionAudio,
        "type": type,
      };
}

class QuizAnswer {
  QuizAnswer({
    this.id,
    this.simpAnswer,
    this.tradAnswer,
    this.answerAudio,
    this.answerImage,
    this.isCorrect,
  });

  String? id;
  String? simpAnswer;
  String? tradAnswer;
  String? answerAudio;
  String? answerImage;
  bool? isCorrect;

  factory QuizAnswer.fromJson(Map<String, dynamic> json) => QuizAnswer(
        id: json["id"],
        simpAnswer: json["simp_answer"],
        tradAnswer: json["trad_answer"],
        answerAudio: json["answer_audio"],
        answerImage: json["answer_image"],
        isCorrect: json["isCorrect"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "simp_answer": simpAnswer,
        "trad_answer": tradAnswer,
        "answer_audio": answerAudio,
        "answer_image": answerImage,
        "isCorrect": isCorrect,
      };
}
